/*
 * @Author: HuangYue
 * @Date: 2022-02-26 19:17:10
 * @LastEditors: HuangYue
 * @LastEditTime: 2022-05-07 17:04:21
 * @FilePath: /graduation/src/access.js
 * @Description:
 */
/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */

/**
 * @description: 权限设置
 * @param {*} initialState
 * @return {*}
 */
export default function access(initialState) {
  const { currentUser } = initialState || {};
  //权限判断通过 键值对 true 来判断是否含有权限
  return {
    canAdmin: currentUser && currentUser.access === 'admin', // 平台管理员
    canUser: currentUser && currentUser.access === 'user', // 医院管理员
    canEngineer: currentUser && currentUser.access === 'engineer', // 工程师
  };
}
